<?php
include("../../inc/global.inc");
//check_power("108");
$url="index.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=20;
?>
<?php
if($_GET['del_act']){
mysql_query("delete from faq where id='".$_GET['del_id']."'");
echo "<script>alert('Delete is ok');location='$url';</script>";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/css.css" />
<title>Admin</title>
<script type="text/javascript" src="../js/islogin.js"></script>
</head>
<body>
<center>
  <table width="95%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">FAQ&nbsp;&nbsp;<a href="javascript:history.go(-1)">Back</a></td>
    </tr>
  </table>
  <table width="95%" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000"> 
	<tr align='center'>
	<td width="53" height="30" bgcolor="#8DA8CF">ID</td>
	<td width="242" bgcolor="#8DA8CF">Member id </td>
	<td width="272" bgcolor="#8DA8CF">Add time </td>
	<td width="126" bgcolor="#8DA8CF">Audit</td>
	<td width="106" bgcolor="#8DA8CF">Is Display</td>
	<td width="120" bgcolor="#8DA8CF"></td>
	</tr>
<?php
$sql="select * from faq where 1=1 ".$search_sql." order by faq_sh asc, id desc limit ".($thepage-1)*$maxpage.",$maxpage";

$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
$color=($i%2)?"#FFFFFF":"#eeeeee";
?>
<tr align='center' bgcolor=<?=$color?>>
<td height="25" align="center"><?=$i?></td>
<td align="center"><?=$row[user_name]?></td>
<td align="center"><?=$row[faq_addtime]?></td>
<td align="center"><?php if($row[faq_sh]==1){?><font color="blue">是</font><?php }else{?><font color="#FF0000">否</font><?php }?></td>
<td align="center"><?php if($row[faq_xs]==1){?><font color="blue">是</font><?php }else{?><font color="#FF0000">否</font><?php }?></td>
<td><a href="index_modify.php?xg=ok&xg_id=<?=$row['id']?>&xg_page=<?=$thepage?>">Edit</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="index.php?del_act=ok&del_id=<?=$row['id']?>" onClick="return del()">Del</a></td>
</tr>
<?php
$i++;
}?>
<?php
$totalrecord=mysql_num_rows(mysql_query("select * from faq where 1=1 ".$search_sql));
$totalpage=ceil($totalrecord/$maxpage);
?>
  <tr>
     <td height="31" colspan="9" align="center" bgcolor="#FFFFFF"><form method="get" action="<?=$url?>">
<?php if($thepage>1){?>
   <a href="<?=$url?>">第一页</a>&nbsp;<a href="<?=$url?>?page=<?=$thepage-1?>">上一页</a>&nbsp;
<?php }?>  
<?php if($thepage!=$totalpage){?>
   <a href="<?=$url?>?page=<?=$thepage+1?>">下一页</a>&nbsp;<a href="<?=$url?>?page=<?=$totalpage?>">最后一页</a>&nbsp;
<?php }?>   
   【共<font color="red"><?=$totalrecord?></font>条记录】【每页<font color="red"><?=$maxpage?></font>条记录】【共<font color="red"><?=$totalpage?></font>页】<input type="text" name="page" size="3" onKeyUp="IsDigit(this);">&nbsp;<input type="submit" value="GO"></form></td>
  </tr>
</table>
</center>
</body>
</html>
<script language="javascript">
function IsDigit(obj) 
{ 
if(obj.value.replace(/[\d+]/ig,"").length>0) { 
  alert('请输入数字'); 
  document.getElementById(obj).value =""; 
} 
} 
</script>